package com.dykj.fireFighting.server.base.government.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.dykj.fireFighting.api.base.government.entity.GovListView;
import com.dykj.fireFighting.api.base.government.entity.GovernmentProjectView;
import com.dykj.fireFighting.api.base.government.service.IGovListViewService;
import com.dykj.fireFighting.server.base.government.mapper.GovListViewMapper;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * VIEW
 *
 * @Author JacksonTu
 * @Date  2022-04-26 14:40:40
 */
@Slf4j
@DubboService
@Transactional(rollbackFor = Exception.class)
public class GovListViewServiceImpl extends ServiceImpl<GovListViewMapper, GovListView> implements IGovListViewService {
    @Override
    public PageInfo<GovListView> getPageList(String sName, String beginTime, String endTime, int page, int limit) {

        QueryWrapper queryWrapper=new QueryWrapper();
        if(StringUtils.isNotBlank(sName)){
            queryWrapper.like("sname",sName);
        }
        if(StringUtils.isNotBlank(beginTime)){
            queryWrapper.between("zftime",beginTime,endTime);
        }
        queryWrapper.orderByDesc("create_time");
        PageHelper.startPage(page,limit);
        return new PageInfo<GovListView>(this.baseMapper.selectList(queryWrapper));
    }

}
